package com.docchatlink.constant;

import lombok.Getter;

/**
 * <p>
 *
 * </p>
 *
 * @author Mr.piggy
 * @since 2024/3/27
 */
@Getter
public enum ErrorCodeEnum {

    SUCCESS(200, "成功"),
    ONE(10019, "问答的问题或引用文段可能涉政"),
    TWO(10013, "问答的问题或引用文段有敏感违规信息"),
    THREE(10014, "问答的输出有敏感违规信息"),
    FOUR(60001, "文件类型不对"),
    FIVE(60002, "文件大小超限"),
    SIX(60003, "文件上传失败"),
    SEVEN(60005, "无文件权限"),
    ENGIT(60011, "文件字数超限"),
    NINE(60012, "文件无有校字符"),
    TNE(60005, "无文件权限"),
    ELEVEN(60014, "问答的时候未传入文件 id"),
    TWELVE(62001, "问答的时候，未找到相关文本段"),
    THIRTEEN(68003, "操作太过频繁"),
    FOURTEEN(99999, "内部错误"),
    ;

    private Integer code;

    private String desc;

    ErrorCodeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }


    public static ErrorCodeEnum findByCode(Integer code) {
        for (ErrorCodeEnum statusEnum : ErrorCodeEnum.values()) {
            if (statusEnum.getCode().equals(code)) {
                return statusEnum;
            }
        }
        return null;
    }
}
